IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[GetQuestionnaireAnswerAnswers]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[GetQuestionnaireAnswerAnswers]
GO

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

/******************************************************************
* Name:			GetQuestionnaireAnswerAnswers
* Purpose:		Retrieves a QuestionnaireAnswer based on the QuestionnaireAnswer's
*					id passed in as a parameter.
*
* PARAMETERS
* Name    						Description					
* -------------  				-------------------------------------------
* @questionnaireAnswerId							The Id of the QuestionnaireAnswer whose answers will be retrieved.
******************************************************************/

CREATE Procedure [dbo].[GetQuestionnaireAnswerAnswers] (
		@questionnaireAnswerId		INTEGER	
)
AS
BEGIN

	SET NOCOUNT ON

	Select	Id,
		QuestionnaireAnswerId, 
		Name,
		Value,
		GroupIndicator,
		ParentAnswerId
	FROM Answer (nolock)
	WHERE	QuestionnaireAnswerId = @questionnaireAnswerId

END
GO

SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER OFF
GO
